import React, { Component } from 'react'

export class Ref_class extends Component {

    refbox3=React.createRef();
    componentDidMount() {   
        console.log(this.refs.refbox);
        console.log(this.refbox2);
        console.log(this.refbox3.current);
    }
        
  render() {
    return (
        <div>
        <div ref='refbox'>方法1：Ref_class1不推荐使用</div>
        <div ref={x=>this.refbox2=x}>方法2：Ref_class2推荐使用</div>
        <div ref={this.refbox3}>方法3：Ref_class3</div>
        </div>
    )
  }
}

export default Ref_class